package hk.m4s.lr.repair.test.utils;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import framework.common.zbar.CaptureActivity;
import hk.m4s.lr.repair.test.R;
import hk.m4s.lr.repair.test.ui.baoyang.SqcanDeviceBaoActivity;
import hk.m4s.lr.repair.test.ui.equipment.SqcanDeviceWeixiuActivity;

/**
 * Created by qi.wang on 2017/4/12.
 */

public class CustomDialog extends Activity implements View.OnClickListener {
    private TextView device_maintain, device_repaire;
    private Button cancle;
    private String decice_id = "4";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_normal_layout);
        device_maintain = (TextView) findViewById(R.id.device_maintain);
        device_repaire = (TextView) findViewById(R.id.device_repair);
        cancle = (Button) findViewById(R.id.negativeButton);
        decice_id=getIntent().getStringExtra("result");
        device_maintain.setOnClickListener(this);
        device_repaire.setOnClickListener(this);
        cancle.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent in;
        switch (v.getId()) {
            case R.id.device_maintain:
                in = new Intent(CustomDialog.this, SqcanDeviceBaoActivity.class);
                in.putExtra("decice_id", decice_id);
                in.putExtra("deciceState", "1");
                startActivity(in);
                finish();
                break;
            case R.id.device_repair:
                in = new Intent(CustomDialog.this, SqcanDeviceWeixiuActivity.class);
                in.putExtra("decice_id", decice_id);
                in.putExtra("deciceState", "2");
                startActivity(in);
                finish();
                break;
            case R.id.negativeButton:
                finish();
                break;
        }
    }
}
